from typing import List
from dataclasses_json import DataClassJsonMixin
from dataclasses import dataclass
from shared_types import BIDIR_SLFHLD_EM_STATES, TURNOUT_TYPES


@dataclass
class MagnetConfig(DataClassJsonMixin):
    ground_controller_name: str  # 地面控制器的名称
    index: int  # 位于第多少个电磁铁槽位，从0开始
    reversed: bool # 是否反向动作


@dataclass
class Turnout(DataClassJsonMixin):
    name: str
    type: TURNOUT_TYPES  # 道岔的类型
    magnets: List[MagnetConfig]  # 绑定到该道岔的电磁铁
    # magnet_states: List[BIDIR_SLFHLD_EM_STATES]  # 所有电磁铁当前的状态
    # reversed: List[bool]  # 电磁铁是否反向
